﻿#ifndef IMAGECOMMON_H
#define IMAGECOMMON_H

#include <QImage>
#ifdef USE_HALCON
#include <Halcon.h>
#include <HalconCpp.h>
#endif

#ifdef USE_OPENCV
#include <opencv2/opencv.hpp>
#endif

class ImageCommon
{
public:
#ifdef USE_OPENCV
    static cv::Mat imageToMat(const QImage &image);
    static QImage matToImage(const cv::Mat &mat);
    static QPixmap matToPixmap(const cv::Mat &mat);
#endif
#if((defined USE_OPENCV) && (defined USE_HALCON))
    static HalconCpp::HObject matToHImage(cv::Mat &cv_img);
    static cv::Mat hImageToMat(const HalconCpp::HObject& hobj);
#endif
#ifdef USE_HALCON
    static QImage hImageToImage(const HalconCpp::HObject &from);
    static HalconCpp::HObject imageToHImage(const QImage &from);
#endif
};

#endif // IMAGECOMMON_H
